package com.priusoft.api.controller;

import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
import com.github.pagehelper.Page;
import com.priusoft.api.aop.Token;
import com.priusoft.api.domain.PageDomain;
import com.priusoft.api.domain.Pagination;
import com.priusoft.api.entity.BnTestApplication;
import com.priusoft.api.service.BnTestApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@CrossOrigin
@Controller
public class Test1Controller {

    @Autowired
    private BnTestApplicationService bnTestApplicationService;

    @Token
    @RequestMapping("/test1")
    @ResponseBody
    public BnTestApplication test1() {
        BnTestApplication bnTestApplication = bnTestApplicationService.getById(46144);
        return bnTestApplication;
        //return null;
    }

    @RequestMapping("/project")
    @ResponseBody
    public PageDomain project(Pagination pagination) {
        PageDomain pageDomain = new PageDomain();
        Page page = bnTestApplicationService.select_bntestapplications_mes(pagination, null);
        pageDomain.putSource("bntestapplications",page);
        return pageDomain;
    }

}
